import request from '@/router/axios'
const serviceType = 'BACKEND';
export function fetchList (query) {
  return request({
    url: '/admin/user/page',
    method: 'get',
    params: query
  })
}

export function addObj (obj) {
  return request({
    url: '/admin/user',
    method: 'post',
    data: obj
  })
}

export function getObj (id) {
  return request({
    url: '/admin/user/' + id,
    method: 'get'
  })
}

export function delObj (id) {
  return request({
    url: '/admin/user/' + id,
    method: 'delete'
  })
}

export function putObj (obj) {
  return request({
    url: '/admin/user',
    method: 'put',
    data: obj
  })
}

export function getDetails (obj) {
  return request({
    url: '/admin/user/details/' + obj,
    method: 'get'
  })
}

export function resetPassword (userId) {
  return request({
    url: '/admin/user/reset/' + userId,
    method: 'put'
  })
}

export function unbindThirdAuth(oauthId) {
  return request({
    url: '/auth/user/unbind/' + oauthId,
    method: 'post',
    params:{serviceType},
  })
}

export function bindThirdAuth(oauthId,code) {
  return request({
    url: '/auth/user/bind/' + oauthId,
    params:{code,serviceType},
    method: 'post'
  })
}
